home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
PROGRAMR
/
MWCC03.ZIP
/
RTL.ZIP
/
MCOMMDLG.PAS
next >
Wrap
Pascal/Delphi Source File
|
1993-08-18
|
29KB
|
982 lines
{**********************************************************************}
{* *}
{* Microworks Custom Control Object Library *}
{* *}
{* Version 1.03 *}
{* *}
{* Object Windows Library Extension for Borland Pascal v7.0 *}
{* *}
{* and Turbo Pascal for Windows v 1.5 *}
{* *}
{* MCommDlg : Common Dialog Unit *}
{* *}
{* Copyright 1992-93 Microworks (Jeff Franks) Sydney, Australia. *}
{* *}
{**********************************************************************}
unit MCommDlg;
{$C MOVEABLE DEMANDLOAD DISCARDABLE}
interface
uses Wintypes, WinProcs, CommDlg, MObjects,
{$IFDEF Ver15}
WObjects;
{$ELSE}
Objects, OWindows, ODialogs;
{$ENDIF}
type
{********** Font Dialog **********}
PFontStatic = ^TFontStatic;
TFontStatic = object(TStatic)
CRect : TRect;
function GetColor (Color: PChar): LongInt; virtual;
function CheckRect: Integer; virtual;
procedure WMPaint (var Msg: TMessage); virtual wm_First + wm_Paint;
end;
PFontGroupBox = ^TFontGroupBox;
TFontGroupBox = object(TGroupBox)
constructor InitResource (AParent: PWindowsObject; AnId: Integer; AText: PChar);
procedure SetupWindow; virtual;
procedure WMCtlColor (var Msg: TMessage); virtual wm_First + wm_CtlColor;
procedure WMPaint (var Msg: TMessage); virtual wm_First + wm_Paint;
private
Stat1 : PMWCCStatic;
Stat2 : PFontStatic;
CRect : TRect;
end;
PFontComboBox = ^TFontComboBox;
TFontComboBox = object(TMWCCComboBox)
procedure WMCommand (var Msg: TMessage); virtual wm_First + wm_Command;
end;
PFontCheckBox = ^TFontCheckBox;
TFontCheckBox = object(TMWCCCheckBox)
procedure BMSetCheck (var Msg: TMessage); virtual wm_First + bm_SetCheck;
end;
PChooseFontDlg = ^TChooseFontDlg;
TChooseFontDlg = object(TDialog)
OkBtn, CancelBtn : PMWCCBmpButton;
constructor Init (AParent: PWindowsObject; AName: PChar; FData: PChooseFont);
function Create: Boolean; virtual;
function Execute: Integer; virtual;
procedure SetUpWindow; virtual;
procedure PrepareFontData; virtual;
procedure WMCtlColor (var Msg: TMessage); virtual wm_First + wm_CtlColor;
procedure WMDrawItem (var msg :TMessage); virtual wm_First + wm_DrawItem;
procedure Ok (var msg :TMessage); virtual id_First + id_Ok;
procedure Cancel (var msg :TMessage); virtual id_First + id_Cancel;
private
BMP, BkBrush : HBitmap;
CRect : TRect;
CB1, CB2, CB3, CB4 : PFontComboBox;
GB1 : PMWCCGroupBox;
GB2 : PFontGroupBox;
Check1, Check2 : PFontCheckBox;
end;
PMWCCFontDlg = ^TMWCCFontDlg;
TMWCCFontDlg = object(TChooseFontDlg)
constructor Init (AParent: PWindowsObject; AName: PChar; FData: PChooseFont; ABmp: PChar);
destructor Done; virtual;
function GetClassName : PChar; virtual;
procedure WMPaint (var Msg: TMessage); virtual wm_First + wm_Paint;
end;
PSFXFontDlg = ^TSFXFontDlg;
TSFXFontDlg = object(TChooseFontDlg)
constructor Init (AParent: PWindowsObject; AName: PChar; FData: PChooseFont);
destructor Done; virtual;
function GetClassName : PChar; virtual;
procedure SetUpWindow; virtual;
procedure WMPaint (var Msg: TMessage); virtual wm_First + wm_Paint;
procedure WMNCPaint (var Msg: TMessage); virtual wm_First + wm_NCPaint;
procedure WMNCCalcSize (var Msg: TMessage); virtual wm_First + wm_NCCalcSize;
procedure WMActivate (var Msg: TMessage); virtual wm_First + wm_Activate;
procedure WMNCActivate (var Msg: TMessage); virtual wm_First + wm_NCActivate;
procedure WMActivateApp (var Msg: TMessage); virtual wm_First + wm_ActivateApp;
procedure WMGetMinMaxInfo (var Msg: TMessage); virtual wm_First + wm_GetMinMaxInfo;
private
WinRect : TRect;
szTitle : array[0..144] of char;
end;
{********** Filename Dialog **********}
PFileNameDlg = ^TFileNameDlg;
TFileNameDlg = object(TDialog)
FilePath : array[0..255] of Char;
FileTitle : array[0..12] of Char;
OpenFileName : TOpenFileName;
OkBtn, CancelBtn : PMWCCBmpButton;
constructor Init(AParent: PWindowsObject; AName: PChar; IsOpen: Boolean);
function Create: Boolean; virtual;
function Execute: Integer; virtual;
function DlgTitle: PChar; virtual;
function DefSpec: PChar; virtual;
function DefExt: PChar; virtual;
function DefSpecPos: Byte; virtual;
function OpenFlags: Longint; virtual;
function DoExec: Boolean; virtual;
procedure WMCtlColor (var Msg: TMessage); virtual wm_First + wm_CtlColor;
procedure WMDrawItem (var msg :TMessage); virtual wm_First + wm_DrawItem;
procedure Ok(var msg :TMessage); virtual id_First + id_Ok;
procedure Cancel(var msg :TMessage); virtual id_First + id_Cancel;
private
BMP, BkBrush : HBitmap;
CBox : PMWCCCheckBox;
CB1, CB2 : PMWCCComboBox;
EC : PMWCCEdit;
LB1, LB2 : PMWCCListBox;
Open : Boolean;
end;
PMWCCFileNameDlg = ^TMWCCFileNameDlg;
TMWCCFileNameDlg = object(TFileNameDlg)
constructor Init (AParent: PWindowsObject; AName, ABmp: PChar; IsOpen: Boolean);
destructor Done; virtual;
function GetClassName : PChar; virtual;
procedure WMPaint (var Msg: TMessage); virtual wm_First + wm_Paint;
private
CRect : TRect;
ST : PMWCCEdit;
end;
PSFXFileNameDlg = ^TSFXFileNameDlg;
TSFXFileNameDlg = object(TFileNameDlg)
constructor Init (AParent: PWindowsObject; AName: PChar; IsOpen: Boolean);
destructor Done; virtual;
function GetClassName : PChar; virtual;
procedure SetUpWindow; virtual;
procedure WMPaint (var Msg: TMessage); virtual wm_First + wm_Paint;
procedure WMNCPaint (var Msg: TMessage); virtual wm_First + wm_NCPaint;
procedure WMNCCalcSize (var Msg: TMessage); virtual wm_First + wm_NCCalcSize;
procedure WMActivate (var Msg: TMessage); virtual wm_First + wm_Activate;
procedure WMNCActivate (var Msg: TMessage); virtual wm_First + wm_NCActivate;
procedure WMActivateApp (var Msg: TMessage); virtual wm_First + wm_ActivateApp;
procedure WMGetMinMaxInfo (var Msg: TMessage); virtual wm_First + wm_GetMinMaxInfo;
private
WinRect : TRect;
szTitle : array[0..144] of char;
end;
implementation
const
idw_Stat1 = 56;
idw_Stat2 = 57;
HLib : THandle = 0;
var
ColorRef : TColorRef;
FontData : PChooseFont;
FontText : PChar;
{********** TChooseFontDlg **********}
constructor TChooseFontDlg.Init(AParent: PWindowsObject; AName: PChar; Fdata: PChooseFont);
begin
TDialog.Init(AParent, AName);
DisableTransfer;
FontData := FData;
CB1 := New(PFontComboBox, InitResource(@Self, 1136, 21));
CB2 := New(PFontComboBox, InitResource(@Self, 1137, 21));
CB3 := New(PFontComboBox, InitResource(@Self, 1138, 21));
CB4 := New(PFontComboBox, InitResource(@Self, 1139, 21));
GB1 := New(PMWCCGroupBox, InitResource(@Self, 1072, ' Effects'));
GB2 := New(PFontGroupBox, InitResource(@Self, 1073, ' Sample'));
Check1 := New(PFontCheckBox, InitResource(@Self, 1040));
Check2 := New(PFontCheckBox, InitResource(@Self, 1041));
if GetSystemMetrics(sm_CYSize) = 26 then
begin
OkBtn := New(PMWCCBmpButton, Init(@Self, id_Ok, 556, 34, False, 1, ctl_Flush));
CancelBtn := New(PMWCCBmpButton, Init(@Self, id_Cancel, 556, 126, False, 2, ctl_Flush));
end
else
begin
OkBtn := New(PMWCCBmpButton, Init(@Self, id_ok, 424, 28, False, 1, ctl_Flush));
CancelBtn := New(PMWCCBmpButton, Init(@Self, id_cancel, 424, 104, False, 2, ctl_Flush))